#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
#define N 200010
const int INF=2e9;
int n,a[N],b[N];
int ans[N];
int F[2][N],G[2][N];

int read ()
{
	int k=1,s=0;char ch=getchar ();
	while (!isdigit (ch)) {if (ch=='-') k=-1;ch=getchar ();}
	while (isdigit (ch)) {s=s*10+ch-'0';ch=getchar ();}
	return k*s;
}

struct Node
{
	int minv[21][N];
	
	void Build (int l,int r)
	{
		for (int k=1;k<=20;k++)
			for (int i=l;i+(1<<k)-1<=r;i++)
				minv[k][i]=min (minv[k-1][i],minv[k-1][i+(1<<(k-1))]);
	}
	
	int Query (int l,int r)
	{
		if (l>r) return INF;
		int k=log2 (r-l+1);
		return min (minv[k][l],minv[k][r-(1<<k)+1]);
	}
	
}ST[2];

void Solve (int L,int R)
{
	if (L==R)
	{
		ans[1]=min (ans[1],abs (a[L]-b[L]));
		return;
	}
	int mid=(L+R)>>1;
	Solve (L,mid);
	Solve (mid+1,R);
	F[0][mid+1]=F[1][mid]=INF,G[0][mid+1]=G[1][mid]=INF;
	for (int i=mid;i>=L;i--)
	{
		F[0][i]=min (F[0][i+1],a[i]);
		G[0][i]=min (G[0][i+1],b[i]);
		ST[0].minv[0][i]=abs (F[0][i]-G[0][i]);
	}
	for (int i=mid+1;i<=R;i++)
	{
		F[1][i]=min (F[1][i-1],a[i]);
		G[1][i]=min (G[1][i-1],b[i]);
		ST[1].minv[0][i]=abs (F[1][i]-G[1][i]);
	}
	ST[0].Build (L,mid),ST[1].Build (mid+1,R);
	for (int len=2,i=mid,j=mid;len<=R-L+1;len++)
	{
		int x=max (L,mid+1-len+1),y=min (mid,R-len+1);
		while (i>=x && F[0][i]>F[1][i+len-1]) i--;
		while (j>=x && G[0][j]>G[1][j+len-1]) j--;
		if (x<=min (i,j)) ans[len]=min (ans[len],ST[0].Query (x,min (i,j)));
		if (max (i,j)<y) ans[len]=min (ans[len],ST[1].Query (max (i,j)+len,y+len-1));
		if (i<j)
		{
			int l=i,r=j+1;
			while (l+1<r)
			{
				int p=(l+r)>>1;
				if (F[1][p+len-1]>=G[0][p]) l=p;else r=p;
			}
			if (l>i) ans[len]=min (ans[len],F[1][l+len-1]-G[0][l]);
			if (r<=j) ans[len]=min (ans[len],G[0][r]-F[1][r+len-1]);
		}
		else if (i>j)
		{
			int l=j,r=i+1;
			while (l+1<r)
			{
				int p=(l+r)>>1;
				if (G[1][p+len-1]>=F[0][p]) l=p;else r=p;
			}
			if (l>j) ans[len]=min (ans[len],G[1][l+len-1]-F[0][l]);
			if (r<=i) ans[len]=min (ans[len],F[0][r]-G[1][r+len-1]);
		}
	}
}

void Init ()
{
	n=read ();
	for (int i=1;i<=n;i++)
		a[i]=read ();
	for (int i=1;i<=n;i++)
		b[i]=read ();
}

void Work ()
{
	for (int i=1;i<=n;i++)
		ans[i]=INF;
	Solve (1,n);
	for (int i=1;i<=n;i++)
		printf ("%d\n",ans[i]);
}

signed main ()
{
	freopen("min.in", "r", stdin);
	freopen("min.out", "w", stdout);
	Init ();
	Work ();
	return 0;
}
